import axios from "axios";
import WebUtils from "@/utils/webUtils";

const apiUrl = "http://localhost:8081/order";

export const getOrderList = async () => {
    try {
        WebUtils.addToken();
        const response = await axios.get(`${apiUrl}`);
        WebUtils.isRedirect(response.data.code);
        return response.data;
    } catch (error) {
        throw error;
    }
}

export const getOrderDetail = async (orderId) => {
    try {
        WebUtils.addToken();
        const response = await axios.get(`${apiUrl}/detail/`+ orderId)
        WebUtils.isRedirect(response.data.code);
        return response.data;
    } catch (error) {
        throw error;
    }
}